<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
String contextPath = request.getContextPath();
String groupId = (String)request.getAttribute("groupId");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户组管理</title>
<jsp:include page="/inc/inc.jsp" />
<script type="text/javascript" src="jframe/cfg/list/js/sysmenuList.js"></script>
<script type="text/javascript">
var contextPath = '<%=contextPath%>';
var action = 'sysMenuAction';
var vo=[];
$(function(){
	<%=request.getAttribute("js")%>
	loadTree();	
}); 

function edit(){
	var rows = $('#grid').datagrid('getSelections');
	if(rows.length>1){
		alertWarn("请您只选择一条记录进行操作！");
		return;
	}else if(rows.length==0){
		alertError("请您选择要操作的记录！");
		return;
	}
	var id = getSelection();
	showWin('编辑',contextPath+'/jframe/cfg/edit/sysmenuEdit.jsp?groupId=<%=groupId%>&type=edit&id='+id,600,250);
}

function add(){
	showWin('新增',contextPath+'/jframe/cfg/edit/sysmenuEdit.jsp?id=0&groupId=<%=groupId%>&type=add',600,250);
}

var loadTree = function(){
	  $("#mtree").tree({
			url:action+'.do?method=getRightTrees&groupId=<%=groupId%>',
			onClick:function(node){
				vo=[];
				vo.push({name:'upId',type:'int',logic:'and',operators:'=',value:node.id});	
				$('#grid').datagrid('load',{
				       conditions: obj2json(vo)
				});
			}
	});
};
</script>
</head>
<body class="easyui-layout"> 
	<div region="west" border="true" title="系统菜单" class="cs-west" style="width:180px;height: 100%" border="false">
		<ul id="mtree"  class='tree'></ul>
	</div>
	<div  region="center" border="true" border="false" style="height:100%">		
	<div id="tb" >	
		<a class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>
		<a class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">编辑</a>
		<a class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="del()">删除</a>		
		<br> 
		<span>名称：</span><input id="text" name="text" type="text" style="width: 100px;">
		<span>有效否：</span>
		<select id="active" name="active" class="easyui-combobox" style="width:100px;">
		<option value=""></option>
		<option value="1">有效</option>
		<option value="0">无效</option>
		</select>
		<a class="easyui-linkbutton" plain="true" onclick="find()" iconCls="icon-search">查询</a>		 
	</div>
	<table id="grid" toolbar="#tb" border="0"></table>
	</div>
</body>
</html>